package com.tedu.review.day02;

import com.sun.org.apache.xerces.internal.impl.xs.XSAttributeDecl;

/**
 * 继承问题1：Java只允许单继承 但可以多层继承
 */
class Ancestors{
    private  String name="祖宗";  //私有属性

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
class Grandpa extends Ancestors{
    String name="爷爷";
   public  void tell(){
       System.out.println("你是:"+getName());
   }
}
class Father extends Grandpa{
    String name="父亲";//假设:创建Father对象 tell'方法 输出你是?
    public  void tell() {
        System.out.println("你是:" + getName());
    }

}
public class 继承之后的问题1 {
    public static void main(String[] args) {
        Father f=new Father();
        f.tell();
    }
}
